-
-
Notifications
You must be signed in to change notification settings - Fork 363
bug(Table): unsupported filter data type cause filter icon misalignment #6298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR adds a dedicated NotSupportFilter component for handling unsupported filter types (integrated into TableColumnFilter while removing redundant parameter setup), adjusts Tab component rendering logic and unit tests to account for a new wrapper element, and introduces new tests for the unsupported-filter scenario. Class diagram for NotSupportFilter and TableColumnFilter changesclassDiagram
class FilterBase {
<<abstract>>
+FilterKeyValueAction GetFilterConditions()
+void Reset()
}
class NotSupportFilter {
+string? NotSupportedMessage
+FilterKeyValueAction GetFilterConditions()
+void Reset()
}
class TableColumnFilter {
+ITable Table
+string? NotSupportedMessage
}
FilterBase <|-- NotSupportFilter
FilterBase <|-- TableColumnFilter
NotSupportFilter <.. TableColumnFilter : used in
Class diagram for updated Tab component logicclassDiagram
class Tab {
-bool IsPreventDefault
-static string? GetTabItemClassString(TabItem item)
}
class TabItem {
+bool IsActive
}
Tab o-- TabItem : contains
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ArgoZhang - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@sourcery-ai review |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6298 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 712 714 +2
Lines 31392 31411 +19
Branches 4437 4437
=========================================
+ Hits 31392 31411 +19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ArgoZhang - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ArgoZhang - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `test/UnitTest/Components/TableNotSupportFilterTest.cs:19` </location>
<code_context>
+ pb.Add(a => a.Column, new MockColumn());
+ });
+
+ cut.Contains("不支持的类型,请使用 FilterTemplate 自定义过滤组件");
+
+ var filter = cut.FindComponent<NotSupportFilter>();
</code_context>
<issue_to_address>
Test is dependent on a hardcoded Chinese message.
Asserting a hardcoded localized string can make the test fragile if the message changes. Consider parameterizing the expected value or mocking localization to improve test robustness.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Fixes filter icon misalignment for unsupported data types by introducing a dedicated filter component and cleaning up legacy code.
- Add
NotSupportFiltercomponent to centralize unsupported-type messaging - Update
TableColumnFilterto useNotSupportFilterand remove redundantLocalizerinjection - Adjust Tab component tests and markup, and bump package version to 9.8.0-beta03
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/UnitTest/Components/TableNotSupportFilterTest.cs | New test to verify NotSupportFilter is rendered and resets properly |
| test/UnitTest/Components/TabTest.cs | Updated selectors to include .tabs-body-content-wrap |
| src/BootstrapBlazor/Components/Tab/Tab.razor.cs | Simplified the d-none class condition |
| src/BootstrapBlazor/Components/Filters/TableColumnFilter.razor.cs | Removed unused Localizer injection and OnParametersSet hook |
| src/BootstrapBlazor/Components/Filters/TableColumnFilter.razor | Wrapped unsupported branch with NotSupportFilter |
| src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs | Introduced new logic component for unsupported filters |
| src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor | Added markup for displaying the unsupported message |
| src/BootstrapBlazor/BootstrapBlazor.csproj | Bumped version to 9.8.0-beta03 |
Comments suppressed due to low confidence (3)
test/UnitTest/Components/TableNotSupportFilterTest.cs:30
- Using
[]to initialize aDictionary<string, IFilterAction>is invalid. Consider usingnew Dictionary<string, IFilterAction>().
public Dictionary<string, IFilterAction> Filters { get; set; } = [];
test/UnitTest/Components/TableNotSupportFilterTest.cs:34
- Using
[]to initialize aList<ITableColumn>is invalid. Replace withnew List<ITableColumn>()or a valid collection expression.
public List<ITableColumn> Columns => [];
src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs:26
Localizeris referenced but not injected in this component. InjectIStringLocalizer<NotSupportFilter> Localizer { get; set; }to avoid compilation errors.
NotSupportedMessage ??= Localizer[nameof(NotSupportedMessage)];
Link issues
fixes #6291
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Introduce a dedicated NotSupportFilter component to handle unsupported filter types and fix filter icon alignment in the Table component, refactor TableColumnFilter to use the new component and remove its localizer dependency, simplify TabItem class logic, and update/add tests to align with the new markup.
New Features:
Bug Fixes:
Enhancements:
Tests: